import { createApp } from 'vue';
import App from './App.vue';
import router from './router';
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
import axios from 'axios';
import { ElMessage } from 'element-plus'; // 显式引入 ElMessage

const app = createApp(App);

// 注册ElementPlus图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}

// 显式注册 $message
app.config.globalProperties.$message = ElMessage;

// 注册ElementPlus
app.use(ElementPlus);

// 注册路由
app.use(router);

// 设置axios
app.config.globalProperties.$axios = axios;

// 挂载应用
const vm = app.mount('#app');

// 测试 $message
console.log('$message 是否可用:', typeof vm.$message === 'function');